package com.hanoiwiki.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name="BLOCKS")
public class Blocks extends BaseObject {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="ID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	
	@Column(name="LONGTITUE")
	private Float longtitue;
	
	@Column(name="LATITUE")
	private Float latitue;
	
	@Column(name="RANGE")
	private Float range;
	
	@Column(name="DESCRIPTION")
	private String description;
	
	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "BLOCKS_COORDINATES", joinColumns = {@JoinColumn(name = "BLOCK_ID")}
										, inverseJoinColumns={@JoinColumn(name = "COOR_ID")})
	private List<Coordinates> coordinates;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Float getLongtitue() {
		return longtitue;
	}
	public List<Coordinates> getCoordinates() {
		return coordinates;
	}
	public void setCoordinates(List<Coordinates> coordinates) {
		this.coordinates = coordinates;
	}
	public void setLongtitue(Float longtitue) {
		this.longtitue = longtitue;
	}
	public Float getLatitue() {
		return latitue;
	}
	public void setLatitue(Float latitue) {
		this.latitue = latitue;
	}
	public Float getRange() {
		return range;
	}
	public void setRange(Float range) {
		this.range = range;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
}
